package com.gang.mars.basic.jvm;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * 类说明：gang.chen JVM 深度实践
 * -Xms600m 设置堆初化空间大小 600M$
 * -Xmx600m 设置堆最大空间大小 600M
 * -XX:SurivorRatio=8
 * @author gang.chen
 * @since 2022/7/9
 */
public class HeapInstanceTest {

    //单位转化
    // 1024KB = 1M

    public static void main(String[] args) throws InterruptedException {
        byte[] buffer = new byte[new Random().nextInt(1024 * 100)];

        //89861 Byte = 89.968KB=

        Thread.sleep(1000);

        List<HeapInstanceTest> heapList = new ArrayList<>();

        while (true){

            heapList.add(new HeapInstanceTest());

            Thread.sleep(3000);

            System.out.println("HeapInstanceTest.main...");
        }
    }
}
